package io.renren.modules.manage.controller;

import java.util.Arrays;
import java.util.Map;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.manage.entity.SubOrderEntity;
import io.renren.modules.manage.service.SubOrderService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author hyc
 * @email 2250242464qq.com
 * @date 2024-04-12 00:05:17
 */
@RestController
@RequestMapping("manage/suborder")
public class SubOrderController {
    @Autowired
    private SubOrderService subOrderService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("manage:suborder:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = subOrderService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("manage:suborder:info")
    public R info(@PathVariable("id") Integer id){
		SubOrderEntity subOrder = subOrderService.getById(id);

        return R.ok().put("subOrder", subOrder);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("manage:suborder:save")
    public R save(@RequestBody SubOrderEntity subOrder){
		subOrderService.save(subOrder);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("manage:suborder:update")
    public R update(@RequestBody SubOrderEntity subOrder){
		subOrderService.updateById(subOrder);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("manage:suborder:delete")
    public R delete(@RequestBody Integer[] ids){
		subOrderService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
